import request from '@/utils/request'
// 日考勤统计
export function dailyAttendanceStatisticList(info) {
    return request({
        url: `/attendance/attendance-record/daily`,
        method: 'get',
        params: info
    })
}

// 日考勤列表
export function getDailyAttendanceList(info) {
    return request({
        url: `/attendance/attendance-record/attendanceList`,
        method: 'get',
        params: info
    })
}
// 年龄
export function getAge(birth) {
    var a = new Date();
    var b = new Date(birth);
    var d = Math.abs(a.getTime() - b.getTime()) / 1000 / 24 / 60 / 60;
    var age = Math.ceil(d / 365); //Math.floor/Math.ceil/四舍五入——Math.round
    return birth==null?0:age
}
//增加日考勤
export function insertAttendance(info) {
    return request({
        url: `/attendance/attendance-record/insertAttendance`,
        method: 'post',
        data: info
    })
}
// 确认考勤
export function confirmAttendance(info) {
    return request({
        url: `/attendance/attendance-record/mandatoryConfirmation`,
        method: 'post',
        data: info
    })
}
// 修改日考勤
export function updateAttendance(info) {
    return request({
        url: `/attendance/attendance-record/update`,
        method: 'post',
        data: info
    })
}
//删除日考勤或月考勤详情
export function deleteDayAttendances(info) {
    return request({
        url: `/attendance/attendance-record/deleteDayAttendances`,
        method: 'get',
        params: info
    })
}
// 月考勤统计
export function monthlyAttendanceStatisticList(info) {
    return request({
        url: `/attendance/attendance-record/monthly`,
        method: 'get',
        params: info
    })
}
// 月考勤列表
export function getMonthAttendanceList(info) {
    return request({
        url: `/attendance/attendance-record/monthAttendanceList`,
        method: 'get',
        params: info
    })
}
// 月考勤详情
export function getMonthAttendanceDetails(info) {
    return request({
        url: `/attendance/attendance-record/month`,
        method: 'get',
        params: info
    })
}
// 删除月考勤统计
export function deleteMonthAttendanceStatistics(info) {
    return request({
        url: `/attendance/attendance-record/deleteMonthlyStatistics`,
        method: 'get',
        params: info
    })
}
// 删除月考勤列表
export function deleteMonthAttendanceList(info) {
    return request({
        url: `/attendance/attendance-record/deleteMonthAttendances`,
        method: 'get',
        params: info
    })
}
//劳务公司确认
export function corporationConfirm(info) {
    return request({
        url: `/attendance/monthly-attendance-confirm/corporation/confirm`,
        method: 'post',
        data: info
    })
}
//项目方确认
export function projectConfirm(info) {
    return request({
        url: `/attendance/monthly-attendance-confirm/project/confirm`,
        method: 'post',
        data: info
    })
}
//考勤导出
export function dailyExport(info) {
    return request({
        url: `/attendance/attendance-record/daily/export`,
        responseType : 'blob',
        method: 'get',
        params: info
    })
}
//修改月考勤天数
export function update(info) {
    return request({
        url: `/attendance/monthly-attendance-confirm/monthlyAttendance/update`,
        method: 'post',
        data: info
    })
}